<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/web/templates/template-fw-arq.xhtml">
	<ui:define name="title">Dashboard: Demonstrações Consolidadas do Resultado do(a) #{mBeanViewerDemoConsol.entidadeAExibir}</ui:define>
	<ui:define name="body">
	    <h:form>
		    <p:dataGrid
		        id="dataGridEvolucaoContas" 
		        style="margin:0px auto;width:100%;height:100%;font-weight:bold;"
		        var="beanViewerConta" value="#{mBeanViewerDemoConsol.beansViewerContas}"
		        columns="1" 
		        emptyMessage="Não há contas recuperadas para entidade informada.">
		        <p:panelGrid style="margin:0px auto;width:100%;height:100%;font-weight:bold;">
			        <p:row>
			            <p:column style="width:80%;word-wrap:break-word;white-space:normal;"
			                colspan="#{empty beanViewerConta.extendedStats ? 2 : 1}">
			                <p:chart type="#{beanViewerConta.chartType}" widgetVar="widgetVarContaChart_#{beanViewerConta.label}"
			                    model="#{beanViewerConta.chartModel}"
			                    style="height:480px;">
			                </p:chart>
			                <p:commandButton action="#{mBeanViewerDemoConsol.detalharSubcontas(beanViewerConta)}"
			                    process="@this"
			                    onclick="PF('widgetViewerSubcontasDemoConsol').show()"
			                    icon="ui-icon-search"
			                    title="Detalhar"
			                    rendered="#{!beanViewerConta.consolidado}">
			                    <f:setPropertyActionListener 
			                        target="#{mBeanViewerDemoConsol.telaEmExibicaoSubcontas}" 
			                        value="#{true}" />
			                </p:commandButton>
			            </p:column>
			            <p:column style="width:20%;word-wrap:break-word;white-space:normal;"
			                rendered="#{!empty beanViewerConta.extendedStats}">
			                <p>Min: <h:outputText value="#{beanViewerConta.extendedStats.min}"><f:convertNumber locale="pt_BR" /></h:outputText></p>
			                <p>Max: <h:outputText value="#{beanViewerConta.extendedStats.max}"><f:convertNumber locale="pt_BR" /></h:outputText></p>
			                <p>Média: <h:outputText value="#{beanViewerConta.extendedStats.avg}"><f:convertNumber locale="pt_BR" /></h:outputText></p>
			                <p>Desvio padrão: <h:outputText value="#{beanViewerConta.extendedStats.stdDeviation}"><f:convertNumber locale="pt_BR" /></h:outputText></p> 
			            </p:column>
			        </p:row>
			        <p:row rendered="#{!empty beanViewerConta.mensagem}">
			            <p:column colspan="2">
				            <div class="ui-messages-warn ui-corner-all" style="margin:0px auto;width:95%;font-weight:bold;">
				                <span class="ui-messages-warn-icon"></span>
				                <span class="ui-messages-warn-summary">
				                    #{beanViewerConta.mensagem.mensagem}
				                </span>
				            </div>
			            </p:column>
			        </p:row>
		        </p:panelGrid>
		    </p:dataGrid>
		    <ui:include src="/web/page/democonsol/viewer/dialogoViewerSubcontasDemoConsol.xhtml" />
		    <ui:include src="/web/page/democonsol/viewer/dialogoViewerSubSubcontasDemoConsol.xhtml" />
		    <p:poll interval="600" update="dataGridEvolucaoContas" />
	    </h:form> 
	</ui:define>
</ui:composition>

</html>
